﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jumpton.Persistent;
using Jumpton.Data;
using Jumpton.SFA.Entity;
using Jumpton.SFA.Server.Entity;
namespace Jumpton.SFA.Server.BusinessRule.CallRoute
{
    public class VisitTypeManager
    {
        public ObjectTable LoadTypes(int DomainID, bool? Active)
        { 
            return new ObjectTable(typeof(VisitType), String.Format("this.DOMAINID={0} {1}", DomainID, Active == null ? "" : " and Active=" + (Active.Value ? "1" : "0")));
        }
        public ObjectTable LoadTypes(decimal DomainID, bool? Active)
        {
            return new ObjectTable(typeof(VisitType), String.Format("this.DOMAINID={0} {1}", DomainID, Active == null ? "" : " and Active=" + (Active.Value ? "1" : "0")));
        }
        public VisitType LoadType(int ID)
        {
            return (VisitType)ObjectRow.Load(typeof(VisitType), String.Format("ID={0}", ID));
        }
        public bool Save(VisitType visittype)
        {
            if (visittype != null)
            {
                try
                {
                    visittype.Save();
                    return true;
                }
                catch { return false; }
            }

            return false;
        }
    }
}
